package cevent.source.cloudcenter.server.exception;/**
 * Created by Cevent on 2021/5/15.
 */

/**
 * @author cevent
 * @description 业务异常处理
 * @date 2021/5/15 16:21
 */
public class BusinessException extends RuntimeException{
    private BusinessExceptionCode businessExceptionCode;

    public BusinessException(BusinessExceptionCode code) {
        super(code.getDesc());
        this.businessExceptionCode=code;
    }
    public BusinessExceptionCode getBusinessExceptionCode(){
        return businessExceptionCode;
    }
    public void setBusinessExceptionCode(BusinessExceptionCode code){
        this.businessExceptionCode=code;
    }

    /**不写入堆栈，提高性能
     * 抛出业务异常时，不打印堆栈信息，可以提高性能。同时没业务异常不需要看堆栈信息
     * @return
     */
    @Override
    public Throwable fillInStackTrace() {
        return this;
    }
}
